#ifndef VIDEOCONFIGWIDGET_H
#define VIDEOCONFIGWIDGET_H
//视频资源配置类（供settingFunc类复用）

#include <QWidget>
#include <QLineEdit>
#include <QSpinBox>
#include <QGridLayout>
#include <QLabel>
#include <QComboBox>
#include <QPushButton>
#include <QSettings>
#include <QNetworkInterface>

#include "myconfig.h"

class VideoConfigWidget : public QWidget
{
    Q_OBJECT
public:
    explicit VideoConfigWidget(int videoMode, QWidget *parent = nullptr);

    void addLayout();  //添加控件布局
    void singleShowMode(); //单显模式
    void TwoShowMode(); //双显模式
    void FourShowMode(); //四显模式
    void controlConnect(); // 控件信号连接
    void changeVideoComb(int index); //改变屏幕显示下拉框
    void showIPInfo(int videoID, QString ipSrc);  //显示IP信息
    void showNetCard();
    void showSolution(int videoID, int width, int height);  //显示分辨率
    void showFPS(int videoID, int fps); //显示帧率
    void showEncodeForm(int videoID, QString form);  //显示编码格式

public slots:
    void onCurrentIndexChanged(int index);  //显示模式切换事件
    void onVideoCfgChanged_1(); //显示器1改变配置事件
    void onVideoCfgChanged_2(); //显示器2改变配置事件
    void onVideoCfgChanged_3(); //显示器3改变配置事件
    void onVideoCfgChanged_4(); //显示器4改变配置事件
    void onNetCardChanged_1(int index);
    void onNetCardChanged_2(int index);
    void onNetCardChanged_3(int index);
    void onNetCardChanged_4(int index);
    void onIpCom_1Changed(int index);
    void onIpCom_2Changed(int index);
    void onIpCom_3Changed(int index);
    void onIpCom_4Changed(int index);

public:
    int m_VideoMode; //0-1 1-2 2-4
    QList<QString> m_netCards;

    QGridLayout *m_gridLayout;

    QComboBox *displayCom;
    QLabel *displayLabel;

    QLabel *resourcesName_1;
    QLabel *resourcesName_2;
    QLabel *resourcesName_3;
    QLabel *resourcesName_4;

    QLineEdit *resourcesNameLine_1;
    QLineEdit *resourcesNameLine_2;
    QLineEdit *resourcesNameLine_3;
    QLineEdit *resourcesNameLine_4;

    QComboBox *ipCom_1;
    QComboBox *ipCom_2;
    QComboBox *ipCom_3;
    QComboBox *ipCom_4;

    QLineEdit *ipLine_1;
    QLineEdit *ipLine_2;
    QLineEdit *ipLine_3;
    QLineEdit *ipLine_4;

    QLabel *port_1;
    QLabel *port_2;
    QLabel *port_3;
    QLabel *port_4;

    QSpinBox *portSpinBox_1;
    QSpinBox *portSpinBox_2;
    QSpinBox *portSpinBox_3;
    QSpinBox *portSpinBox_4;

    //源ip
    QLabel *m_srcIPLabel_1;
    QLabel *m_srcIPLabel_2;
    QLabel *m_srcIPLabel_3;
    QLabel *m_srcIPLabel_4;

    QLineEdit *m_srcIPLine_1;
    QLineEdit *m_srcIPLine_2;
    QLineEdit *m_srcIPLine_3;
    QLineEdit *m_srcIPLine_4;

    //分辨率
    QLabel *m_solutionLabel_1;
    QLabel *m_solutionLabel_2;
    QLabel *m_solutionLabel_3;
    QLabel *m_solutionLabel_4;

    QLineEdit *m_solutionLine_1;
    QLineEdit *m_solutionLine_2;
    QLineEdit *m_solutionLine_3;
    QLineEdit *m_solutionLine_4;

    //帧率
    QLabel *m_fpsLabel_1;
    QLabel *m_fpsLabel_2;
    QLabel *m_fpsLabel_3;
    QLabel *m_fpsLabel_4;

    QLineEdit *m_fpsLine_1;
    QLineEdit *m_fpsLine_2;
    QLineEdit *m_fpsLine_3;
    QLineEdit *m_fpsLine_4;

    //编码格式
    QLabel *m_codeLabel_1;
    QLabel *m_codeLabel_2;
    QLabel *m_codeLabel_3;
    QLabel *m_codeLabel_4;

    QLineEdit *m_codeLine_1;
    QLineEdit *m_codeLine_2;
    QLineEdit *m_codeLine_3;
    QLineEdit *m_codeLine_4;

    QLabel *m_netCardLabel_1;
    QLabel *m_netCardLabel_2;
    QLabel *m_netCardLabel_3;
    QLabel *m_netCardLabel_4;

    QComboBox *m_netCardComb_1;
    QComboBox *m_netCardComb_2;
    QComboBox *m_netCardComb_3;
    QComboBox *m_netCardComb_4;

    QPushButton *update_1;
    QPushButton *update_2;
    QPushButton *update_3;
    QPushButton *update_4;

signals:
    void sigVideoChanged(WINDOW_CONFIG);
    void sigClick(int);
    void sigChangedDisplayMode(int);
};
#endif // VIDEOCONFIGWIDGET_H
